<template>
  <div>
    <div class="tuo2">
      <span @click="fan">◁返回</span>
      <h4>商品</h4>
    </div>
    <div>
        <img class="imgg" v-if="gallery.length" :src="gallery[0].img_url" alt="">
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      Sdata: [],
      gallery:[],
    };
  },
  mounted() {
    this.getdata();
  },
  methods: {
    // 返回上一页
    fan() {
      this.$router.go(-1);
    },
    //获取详情
    getdata() {
        console.log(this.$route.query.ss);
      this.$http(
        `http://shop.bufantec.com/bufan/goods/detailaction?openId=13216484256&id=${this.$route.query.ss}`,
        "get"
      ).then((res) => {
        console.log(res.data);
        this.Sdata = res.data;
        this.gallery = res.data.gallery;
      });
    },
  },
};
</script>

<style lang="scss">
.tuo2 {
  width: 100%;
  height: 45px;
  background: #fff;
  color: coral;
  text-align: center;
  line-height: 45px;
  box-sizing: border-box;
  padding: 0 10px;
  span {
    float: left;
  }
}
.imgg{
    width: 100%;

}
</style>
